package game.core.objects
{
	import flash.events.Event;
	
	import game.core.GameObject;
	import game.core.GameSystem;
	
	/**
	 * 这个检测是用区域好,还是碰撞好呢?
	 */ 
	public class ExplodeBall extends Ball
	{
		public static const EXPLODE_WIDTH:Number = 200;// 爆破的区域的范围
		public static const EXPLODE_HEIGHT:Number = 200;
		public function ExplodeBall()
		{
			super();
		}
		
		/**
		 * 播放mc同时去检测
		 */ 
		override public function execute():void {
			this.addEventListener(Event.ENTER_FRAME,enterFrameHandler);
		}
		
		private function enterFrameHandler(event:Event):void {
			var gameObjects:Array = GameSystem.instance.gameObjects;
			for each(var gameObject:GameObject in gameObjects){
				if(gameObject.hitTestObject(this)){
					gameObject.execute();
				}
			}
			// 如果动画播放到最后一帧时,需要删除事件
		}
	}
}